﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>${setting.siteName} - 新增药品分类表</title>
    <meta name="keywords" content="${setting.siteName}">
  	<meta name="description" content="${setting.siteName}">
  	<!-- BEGIN HEADER -->
		[#include "/admin/include/style.ftl"]
	<!-- END HEADER -->
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                    	 <h5>新增药品分类表</h5>
                    	 <div class="ibox-tools">
                    	 	<button type="button" class="btn btn-outline btn-white btn-xs" id="btn-return-loippi" 
                    	 	onclick="location.href='${base}/admin/category/list.jhtml'"><i class="fa fa-reply-all"></i> 返回列表</button>
                        </div>
                    </div>            	
                  	<div class="ibox-content">
                  		<form id="inputForm" class="form-horizontal" action="save.jhtml" method="post">
                      
                          <div class="form-group">
                       		<div class="row">
                       			<div class="col-sm-6">
                       			 	<label class="col-sm-3 control-label">分类名称</label>
	                                <div class="col-sm-9">
	                                    <input type="text" name="name" class="form-control" maxlength="200" />
	                                </div>
                       			</div>
[#--                       		  <div class="col-sm-6">--]
[#--                       			 	<label class="col-sm-3 control-label">分类描述</label>--]
[#--	                                <div class="col-sm-9">--]
[#--	                                    <input type="text" name="description" class="form-control" maxlength="200" />--]
[#--	                                </div>--]
[#--                       			</div>--]
							</div>
                        </div>
							<!--/row-->

[#--                          <div class="form-group">--]
[#--                       		<div class="row">--]
[#--		                        <div class="col-sm-6">--]
[#--                       			 	<label class="col-sm-3 control-label">分类图片</label>--]
[#--	                                <div class="col-sm-9">--]
[#--																		<img id="imgPath" class="imgPath" src="${category.image}" />--]
[#--																		<input type="file" name="file"  class="form-control upload" onchange="change(this)" maxlength="200" required="required"/>--]
[#--																		<input type="button"  class="btn btn-warning uploadBtn"  value="上传"/>--]
[#--																		<input type="hidden" name="image" class="form-control imagePath" maxlength="200" />--]
[#--                                      --][#--																		<input type="text" name="image" class="form-control" maxlength="200" />--]
[#--	                                </div>--]
[#--                       			</div>--]
[#--                       			<div class="col-sm-6">--]
[#--                       			 	<label class="col-sm-3 control-label">状态</label>--]
[#--			                        <div class="col-sm-9">--]
[#--				                        <input type="radio" name="status" value=0 />禁用--]
[#--				                        <input type="radio" name="status" value=1 />启用--]
[#--			                        </div>--]
[#--                       			</div>--]
[#--													</div>--]
[#--                        </div>--]
							<!--/row-->
                        <div class="hr-line-dashed"></div>
	                    <div class="form-group">
	                        <div class="col-sm-12 col-sm-offset-10">
	                        	<button type="button" class="btn btn-default" onclick="window.history.back();">返回</button>
	                            <button class="btn btn-success" type="submit">保存内容</button>
	                        </div>
	                    </div>
	                    </form>
                  	</div>
                </div>
            </div>
        </div>
    </div>
	<!-- BEGIN Script -->
		[#include "/admin/include/script.ftl"]
	<!-- END Script -->
    <script>
    
        $(document).ready(function () {
        	[@flash_message /]
        	$(".chosen-select").chosen({width:"100%"}); 
        	$(".input-daterange").datepicker({keyboardNavigation:false,forceParse:false,autoclose:true});
        	
        	$(".browserButton").browser({callback:function(url){
				$("#"+$(this).attr('for')).val(url);
			}});
        	
    		$(".input-group.date").datepicker({todayBtn:"linked",keyboardNavigation:false,forceParse:false,calendarWeeks:true,autoclose:true});
        	$("#inputForm").validate({
                rules: {
                  name: {
                    required: true
                  },
                  description: {
                    required: true
                  }
                },
                messages: {
				}
            });
        });

        // 上传
        function change(obj) {
          var that = obj;
          var formData = new FormData();
          var fileObj = $(obj)[0].files[0];
          formData.append("file",fileObj);
          $.ajax({
            url:'${base}/admin/file/upload.jhtml',
            type:'POST',
            data:formData,
            dataType: "json",
            async:false,
            processData:false,
            contentType:false,
            success:function(data){
              $(that).parent().find(".imgPath").show();
              $(that).parent().find(".imgPath").attr("src",data.url);
              $(that).parent().find(".uploadBtn").css({"top":"100px"});
              $(that).parent().find(".imagePath").val(data.url);
              $(that).parent().find(".uploadBtn").val("修改");
            }
          })
        }

    </script>
</body>
</html>
